home *** CD-ROM | disk | FTP | other *** search
/ Mission 3 / Mission 3.zip / Mission 3.iso / spiele / sac / manual / chapter4.doc < prev    next >
Text File  |  2012-11-26  |  24KB  |  544 lines

  1.                           CHAPTER FOUR
  2.                       (The editor program)
  3.  *****************************************************************
  4.  
  5.    What you have now is a simple adventure game. Loading the games 
  6.    data into the tester program (TEST.PRG) just allows you to see 
  7.    if everything is correct. In other words you should now be able 
  8.    to take, examine, drop, wear, and move objects. You should also 
  9.    be able to move from location to location using the movement 
  10.    commands (north, south, etc...), and other commands like 
  11.    "look" and "quit" work as normal.
  12.  
  13.    Typing "i" for inventory would have given you a list of any 
  14.    objects carried and worn as inputed in the creator program, if 
  15.    you see any mistakes such as spelling mistakes then all you 
  16.    have to do is load the data file back into the creator, check the
  17.    data you put in and use the amend options to correct them. After 
  18.    this, save the data file back to disk with the name "TEST.ADV".
  19.  
  20.    If everything is fine then we can continue with the final stage 
  21.    of creating an adventure but first look at what you've done so 
  22.    far, you have created an adventure game quickly and easily 
  23.    without the need of any programing skills so why not sit back, 
  24.    relax and have a brew and maybe a fag and admire your work.
  25.  
  26.    The next stage of creating an adventure with sac involves a bit 
  27.    of programming using STOS basic to add the extra information to 
  28.    the game. Don't worry if your programing skill is'nt so good as 
  29.    I will be providing the needed routines for you.
  30.  
  31.    Load up STOS and type "load "editor.bas" or just use the file 
  32.    selector to load it. When it has loaded, list it and have a 
  33.    look at it. This is the editor program which already contains 
  34.    the routines found in a standard adventure game and we are 
  35.    going to add some extra lines to it.
  36.  
  37.    As you can see, sac is not a normal adventure creator like 
  38.    STAC, its a programing tool for STOS. Seeing the editor program 
  39.    is a normal STOS basic listing you can add extra touches like 
  40.    music and samples and anything else you can think of.
  41.  
  42.    I will now take you step by step through the editor program.
  43.  
  44.  *****************************************************************
  45.                            VARIBLES 
  46.  *****************************************************************
  47.  
  48.    Varibles are things that check on the status of things, for 
  49.    example they can be used to see if a door is open or closed.
  50.  
  51.    Varibles is set up like this......
  52.  
  53.     10 let A=1 : let A$="hello"
  54.  
  55.    Here we see the use of the LET command which is the command 
  56.    used for setting varibles. You can think of varibles as small 
  57.    boxes with a label on, containing numbers or words. 
  58.  
  59.    Look at lines 110 to 230 of the editor program and you will see 
  60.    that this is the part of the program where we put our varibles.
  61.    Looking at line 110 we see some varibles already set, these are 
  62.    needed by the editor program and must not be changed or used 
  63.    for other purposes. Lets see what they mean.
  64.  
  65.    LOC:- This varible holds the present location number, this is 
  66.    set to 1 which tells the game to start from location one.
  67.  
  68.    TURNS:- Every time you do something in an adventure it adds one 
  69.    to this varible. For example typing a command like "get lamp" 
  70.    would add one turn and "go north" would add another turn.
  71.  
  72.    SC0RE:- This varible holds the players present score.
  73.  
  74.    CARRY:- Holds the number of objects carried, this varible 
  75.    equals another varible called CAR, this varible is used in the 
  76.    creator program and its tells the editor program how many 
  77.    objects you entered as CARRIED. In St brides there is only one 
  78.    object put in the carried location so CAR would equal 1.
  79.  
  80.    WEAR:- This holds the number of objects presently in the WORN 
  81.    location, like CAR it is set to the varible WEA setting the 
  82.    WEAR varible to the number of objects in the WORN location.
  83.  
  84.    The next line has three varibles holding the special location 
  85.    numbers that the creator uses. More details on this later.
  86.  
  87.    You will have noticed that none of these varibles use the LET 
  88.    command. Well you can use it if you want but STOS allows you to 
  89.    omit it. So you can type "A=1" instead of "let A=1".
  90.  
  91.    You can give your varibles any name you like except for those 
  92.    used by the editor program. Heres a list of them.
  93.  
  94.    
  95.   LOC,TURNS,SC0RE,CARRY,CAR,WEA,X,Y,A,B,FOUND,NO,D,DONE,COUNT,CHAR
  96.                  TEST,OB,LO,SCR,OBJ,EO,ME,EL.
  97.  
  98.                   Other names are okay to use.
  99.  
  100.    STOS has a small problem with varibles, if it finds one with a 
  101.    keyword in it then it will cause an error. For example if you 
  102.    decided to name your varible as SINGLE, this would be 
  103.    pronounced by STOS like this.....
  104.  
  105.    150 sin GLE=2
  106.  
  107.    As you can see STOS thinks you are using the SIN command.
  108.  
  109.    If you look at the SC0RE varible you will see that the letter O 
  110.    is a nought, this stops STOS interperting line 110 as....
  111.  
  112.    110 LOC=1 : TURNS=0 : SC or CE=0 : CARRY=CAR : WEAR=WEA
  113.  
  114.    Line 40 of the editor program holds the DIM commands needed by 
  115.    the editor and there are three other arrays called EXIT$, EXIT 
  116.    and WRD$. DIM commands other than these can be used.
  117.  
  118.    We shall discuss the use of varibles in the next section but 
  119.    first look at lines 80 and 100 of the editor program.
  120.  
  121.    Line 80 loads a title screen, so before you can run the editor 
  122.    program you will have to put a screen called SAC.PI1 on the 
  123.    same disk you are currently using unless you delete it.
  124.  
  125.    Line 100 uses the FADE command to make the first two colours in 
  126.    the present palette black for the background and white for the 
  127.    text. This can be changed to the first two colours of your choice.
  128.  
  129.                      HIGH PRIORITY EVENTS
  130.   ****************************************************************
  131.  
  132.    An high priority event is the part of the game that checks the 
  133.    present location before the player, these can be used to inform 
  134.    the player of his condition.
  135.  
  136.    Looking at the editor program we see that lines 330 to 550 are 
  137.    reserved for your own H-P events, lets say that the player has 
  138.    hurt his leg, an H-P event could tell him about it.
  139.  
  140.    First we could define a varible called LEG, this could be set 
  141.    to 0 at the start of the game. So if the player hurt his leg by 
  142.    falling in a pit you could set LEG to 1, then you can test if 
  143.    his leg is hurt with the following line.......
  144.  
  145.    340 if LEG=1 then print MESSAGE$(1)
  146.  
  147.    The MESSAGE$(1) part of the line holds a message telling the 
  148.    player that his leg hurts, this is an array which holds the 
  149.    messages you defined in the creators MESSAGES option.
  150.  
  151.    An array is a row of boxes with the same label and each box can 
  152.    contain letters or numbers. For example the command DIM A(10) 
  153.    labels ten boxes with the letter A.
  154.  
  155.    In the above example the game would print message 1 if the 
  156.    varible LEG was set to 1. Message 1 could be......
  157.  
  158.                   Your leg hurts a lot.
  159.  
  160.    In St brides an H-P event is used to see if the player is 
  161.    wearing the teachers gown. If he is then the game will display 
  162.    message 3 otherwise it will display message 4. Play the game 
  163.    and go into the staffroom wearing the teachers gown, read the 
  164.    message, leave, remove the gown and go back in and read the new 
  165.    message. You will then understand what I mean.
  166.  
  167.    So there we have it. An H-P event is the part of the adventure 
  168.    that checks the location just before the player enters it.
  169.  
  170.          More about high priority events later on.
  171.  
  172.                      DIFFERENT EXITS  
  173.   ****************************************************************
  174.  
  175.    Normally when the player tries to go in a direction thats 
  176.    blocked off the game will just tell him that he can't go that 
  177.    way. This would be useless if the player tried to go up an hill 
  178.    and the game told him that he could'nt go that way. He would 
  179.    want to know why. Look at this location description...
  180.  
  181.    You are in a clearing surrounded by dense forest. To the east 
  182.    is a footpath and north leads into a cave.
  183.  
  184.    Lets say we wanted to block the cave with a large rock, we 
  185.    could define a message saying "A large rock is in the way." 
  186.    then avoid entering the connection north to the inside of the 
  187.    cave from the above location.
  188.  
  189.    The editor program uses an array called WRD$(WN) which contains
  190.    the words entered by the player. WN is the number of the word 
  191.    and ranges from 1 to 10 so if the player entered "hit troll" 
  192.    then WRD$(1) would be "hit" and WRD$(2) would be "troll".
  193.  
  194.    This would be used in a line like this.....
  195.  
  196.    10 if WRD$(1)="hit" and WRD$(2)="troll" then (do something)
  197.  
  198.    There is also a varible called D which holds the number of the 
  199.    direction command entered, Heres a list of them.
  200.  
  201.       North (direction 1)     North west (direction 5)
  202.       South (direction 2)     North east (direction 6)
  203.       West  (direction 3)     South west (direction 7)
  204.       East  (direction 4)     South east (direction 8)
  205.            Up (direction 9)   Down (direction 10)
  206.  
  207.    We can now enter this line in the different exits section.
  208.  
  209.    810 if WRD$(1)="go" and WRD$(2)="north" and LOC=10 and D=0 then 
  210.        print MESSAGE$(5)
  211.  
  212.    Here we see the use of the LOC varible which tells the adventure 
  213.    only to carry out this line if the above location is location 
  214.    ten and the player types "go north". If there is no connection 
  215.    north then D is set to nought otherwise it is set to 1. The 
  216.    line then prints message 5 telling the player about the rock.
  217.  
  218.    Note the above line is only carried out if "go north" is typed, 
  219.    if "n" which is short for "go north" then you would have to 
  220.    enter the extra line to check for this like so.
  221.  
  222.    820 if WRD$(1)="n" and LOC=10 and D=0 then print MESSAGE$(5)
  223.  
  224.                      SPECIAL GET COMMANDS
  225.   ***************************************************************
  226.  
  227.    Normally the player can get any objects lying around in the 
  228.    present location but the player could try getting a snake which 
  229.    would'nt be too happy about being kidnapped. Normally an object 
  230.    would be moved to the carried location after being picked up but 
  231.    a snake could bite the player and poison him.
  232.  
  233.    Lines 1160 to 1320 are reserved for these special get commands, 
  234.    such a line would appear as...
  235.  
  236.    1170 if WRD$(2)="snake" and OB_LOC(2)=LOC then print MESSAGE$(4) 
  237.         : goto 2610
  238.  
  239.    Whenever the player wants to get an object this part of the 
  240.    adventure is reached, the word "get" goes into WRD$(1) and then 
  241.    the editor program looks for the object word in its list. When 
  242.    its found it checks if the object is at the present location 
  243.    and if so, moves it to the carried location.
  244.  
  245.    Here we see yet another array called OB_LOC(OP) this holds the
  246.    present location of object OP. The above line is checking if 
  247.    object 2 (the snake) is in the same location as the player.
  248.  
  249.    If the line is carried out then message 4 is printed...
  250.  
  251.         The snake has bitten me. I'm dead.
  252.  
  253.    As the player has been killed, the command GOTO 2610 is used. 
  254.    Line 2610 is the part of the program that tells the player his 
  255.    score and number of turns taken then ends the game.
  256.  
  257.    The special get commands could be used in other ways like if 
  258.    the player picks up a magic sword which restores strength.
  259.  
  260.                   SPECIAL DROP COMMANDS
  261.   **************************************************************
  262.  
  263.    Like GET, you can use these commands to allow something special 
  264.    to happen if the player drops a certain object. For example if 
  265.    your adventure required the player to drop a casket down an hill 
  266.    you could then move the object to the location at the bottom of 
  267.    the hill with the following line.
  268.  
  269.    1480 if WRD$(2)="casket" and OB_LOC(8)=CARRIED and LOC=10 then 
  270.         OB_LOC(8)=6 : print MESSAGE$(7) : NO=1 : DONE=1 : 
  271.         WRD$(1)="" : WRD$(2)=""
  272.  
  273.    This is quite a long line so lets go through it step by step.
  274.  
  275.    This line checks if the object word is "casket" which is object 
  276.    number 8 and if its in the carried location and the player is 
  277.    at location ten (the hill). If so then it moves the casket to 
  278.    location six (bottom of the hill) then prints MESSAGE$(7) to 
  279.    tell the player the casket has been dropped down the hill.
  280.  
  281.    The new version of the editor program has been updated to allow 
  282.    you to group commands together like this....
  283.  
  284.    Get the lamp and light it then drop sword
  285.  
  286.    This prints up the three messages....
  287.  
  288.     You now have the lamp.
  289.     The lamp is now lit.
  290.     You have dropped the sword.
  291.  
  292.    This works by going through all the commands to a routine that 
  293.    checks for the words "and" and "then". If found it loops back 
  294.    to the start of the command lines and carrys out the commands 
  295.    after any of these two words. For this to happen you need to 
  296.    put the following at the end of each line.....
  297.  
  298.     NO=1 : DONE=1 : WRD$(1)="" : WRD$(2)=""
  299.  
  300.    If its a line that ends the game, then you don't need to bother.
  301.  
  302.    Lines 1470 to 1610 are reserved for these commands.
  303.  
  304.                       REVEALING OBJECTS
  305.   ****************************************************************
  306.  
  307.    As mentioned before, objects can reveal other objects. For this 
  308.    example we shall use two objects. A vase and a key. In this 
  309.    example we shall allow the key to be found in the vase when the 
  310.    vase is examined. So using the creator we define the vase and 
  311.    put it in a normal location, then define the key and put it in 
  312.    the not created location using the special locations option.
  313.  
  314.    Next we define a message that says "Theres a key in it.". So 
  315.    what we need to do is bring the key from the not created 
  316.    location to the present location when the player examines the 
  317.    vase. Lines 1730 to 1810 is the part of the program which is 
  318.    reserved for these commands.
  319.  
  320.    The line to carry out the above example would be....
  321.  
  322.     1740 if WRD$(2)="vase" and OB_LOC(1)=CARRIED and OB_LOC(2)=NC 
  323.          then print MESSAGE$(1) : OB_LOC(2)=LOC
  324.  
  325.    So if the player types "examine vase" which is object one and 
  326.    its carried by the player and object 2 (the key) has'nt been 
  327.    created yet then message 1 is displayed telling the player he's 
  328.    found the key and moves the key to the present location.
  329.  
  330.    Don't forget to add the NO=1 : DONE=1 : WRD$(1)="" : WRD$(2)="" 
  331.    on the end of these lines so it can group with other commands.
  332.  
  333.    Another use of these commands can be for a crystal ball 
  334.    destroying the player if he examines it.
  335.  
  336.    1750 if WRD$(2)="ball" and OB_LOC(2)=CARRIED then print 
  337.         MESSAGE$(5) : goto 2610
  338.  
  339.    This line tells the player he's dead and ends the game.
  340.  
  341.                    REVEALING LOCATIONS
  342.   **************************************************************
  343.  
  344.    As with the objects we can do other things when the player 
  345.    examines part of the present location. Normally the player would 
  346.    be given a description like "A fire burns proudly in it." if he 
  347.    examines a fireplace in a living room.
  348.  
  349.    In the revealing objects section a key was found in a vase, so 
  350.    for this example we shall create the key and put it in a door.
  351.  
  352.    1900 if WRD$(2)="door" and OB_LOC(2)=NC and LOC=5 then print 
  353.         MESSAGE$(6) : OB_LOC(2)=LOC
  354.  
  355.    This line is a bit like the one in REVEALING OBJECTS but only 
  356.    carrys out the line if the player is at location 5.
  357.  
  358.    As before you can use this part of the program for other reasons.
  359.  
  360.          Lines 1890 to 1970 are reserved for these lines.
  361.  
  362.                      SPECIAL WEAR COMMANDS
  363.   ****************************************************************
  364.  
  365.    Normally any object can be worn and the adventure just tells 
  366.    the player that he's wearing it. But a suit which is too small 
  367.    would rip and an hat which is too big could stop the player 
  368.    from seeing. For this to come into practise we would use a 
  369.    special wear command.
  370.  
  371.    2060 if WRD$(2)="hat" and OB_LOC(7)=CARRIED then print 
  372.         MESSAGE$(3) : NO=1 : DONE=1 : WRD$(1)="" : WRD$(2)=""
  373.  
  374.    So if the player types "wear hat" then message 3 is printed 
  375.    which would say "The hat won't fit so you take it off". The 
  376.    reason for the WRD$(1) and WRD$(2) being cleared is to stop the 
  377.    normal wear commands being carried out.
  378.  
  379.       Lines 2050 to 2120 are reserved for these commands.
  380.  
  381.                       SPECIAL REMOVE
  382.   ***************************************************************
  383.  
  384.    Like special wear commands, we can do special things if the 
  385.    player removes an article of clothing. For example removing a 
  386.    warm jacket in an house would'nt mean anything but removing it 
  387.    in a very cold place could make the player freeze to death.
  388.  
  389.    2230 if WRD$(2)="coat" and LOC=20 and OB_LOC(10)=W0RN then 
  390.         print MESSAGE$(14) : goto 2610
  391.  
  392.    So if the player types "remove coat" and he's in location 20 
  393.    which could be a snowy field then message 14 tells him he has 
  394.    frozen to death and the game ends.
  395.  
  396.        Lines 2220 to 2290 are reserved for these commands.
  397.  
  398.                     OPEN AND CLOSE COMMANDS
  399.  ****************************************************************
  400.  
  401.    You will have noticed that in St brides you can walk from room 
  402.    to room without opening any doors. Well if are walking around 
  403.    the countryside we don't have to open or close any doors but an 
  404.    house would normally have most of its doors closed. So we use 
  405.    lines 2390 to 2440 to see if the player wants to open one.
  406.  
  407.    The creator uses an array called MAP to store the connections 
  408.    from each location. The format of this array is MAP(L,D).
  409.  
  410.    As the player can't go to another location because a closed 
  411.    door is in his way, we use the MAP array to connect his present 
  412.    location to the next one. L is the location number and D is the 
  413.    direction number which ranges from 1 to 10.
  414.  
  415.    This line would open a door at location 15
  416.  
  417.    2400 if WRD$(2)="door" and OP=0 and LOC=15 then MAP(15,1)=16 : 
  418.         OP=1 : print MESSAGE$(11) : NO=1 : DONE=1
  419.  
  420.    And this line would close a door at location 15.
  421.  
  422.    2490 if WRD$(2)="door" and OP=1 and LOC=15 then MAP(15,1)=0 : 
  423.         OP=0 : print MESSAGE$(12) : NO=1 : DONE=1
  424.  
  425.    Line 2400 connects direction one (north) from location 15 to 
  426.    location 16 using the MAP array. OP is a varible which would be
  427.    set to nought if the door is closed and one if its open.
  428.  
  429.    Look at the following location.....
  430.  
  431.    You are in a bedroom. A door leads north.
  432.  
  433.    At the moment the player can't go through the door cause its 
  434.    closed so when he opens it we use MAP to connect the bedroom 
  435.    to the location beyond the door. Lets say the bedroom is 
  436.    location one and location 2 is an hallway which is north.
  437.  
  438.    To connect the two locations together we could use MAP like this.
  439.  
  440.                            MAP(1,1)=2
  441.  
  442.    So the first number is one meaning location one, the second 
  443.    number is the direction number (in this case north) and the 
  444.    third number is location two. So this means define a connection 
  445.    north from location one to location two.
  446.  
  447.    If we wanted to un-connect the two locations then MAP would 
  448.    equal nought. This can be used to close doors. Here are some 
  449.    other examples to make this a bit clearer.
  450.  
  451.    MAP (4,2)=6:- (defines a connection south from location 4 to 6)
  452.    MAP (7,4)=4:- (defines a connection east to location 7 to 4)
  453.    MAP (2,9)=0:- (un-connects connection up from location 2)
  454.    MAP (8,3)=0:- (un-connects connection west from location 8)
  455.  
  456.    Lines 2480 to 2530 are reserved for the close commands.
  457.  
  458.                         LOW PRIORITY EVENTS
  459.  *****************************************************************
  460.  
  461.    Low priority events are any other commands that the player may 
  462.    type in, these are commands such as "light lamp", "kill beast" 
  463.    or even "make tea". All the other commands discussed in this 
  464.    chapter like "get", "drop", "examine", "wear","open" etc... are 
  465.    commands found in every adventure game but L-P events are used 
  466.    for other events happening in your adventures.
  467.  
  468.    Suppose your adventure required the player to kill a dragon, 
  469.    you would define a varible called DRAGON this would set it to one
  470.    if the dragon is alive and two if it was dead. You would then 
  471.    define two messages. The first one saying "A dragon is here." 
  472.    and the second one saying "A dead dragon is here".
  473.  
  474.    You could put this dragon in a location using H-P events.
  475.  
  476.    850 if LOC=10 and DRAGON=1 then print MESSAGE$(1)
  477.    860 if LOC=10 and DRAGON=0 then print MESSAGE$(2)
  478.  
  479.    So when the player enters location ten he will be imformed of 
  480.    the dragon. If its alive message one will print up and if its 
  481.    dead message two prints up.
  482.  
  483.    To check for the player killing the dragon just enter this line 
  484.    as a low priority event.......
  485.  
  486.    2780 if WRD$(1)="kill" and WRD$(2)="dragon" and DRAGON=1 and 
  487.     LOC=10 then print MESSAGE$(3) : DONE=1 : WRD$(1)="" : WRD$(2)=""
  488.  
  489.    I'll now show you how to light a lamp using L-P events.
  490.  
  491.    Using the creator, define two objects.....
  492.  
  493.    1. a lamp.
  494.    2. a lit lamp
  495.  
  496.    Put the lamp in the carried location and the lit lamp in the 
  497.    not created location. The lit lamp does not yet exist in the 
  498.    game because all not created objects go to location nought, in 
  499.    other words they are put aside until the game puts them in 
  500.    another location. What we are doing here is swapping the two 
  501.    lamps when the player types "light lamp".
  502.  
  503.    This is done by the following line.......
  504.  
  505.    2790 if WRD$(1)="light" and WRD$(2)="lamp" and OB_LOC(1)=CARRIED
  506.         then OB_LOC(1)=NC : OB_LOC(2)=CARRIED : print MESSAGE$(3) 
  507.         : DONE=1 : WRD$(1)="" : WRD$(2)=""
  508.  
  509.    This line checks if the lamp is carried and if so puts it to 
  510.    the not created location then it moves the lit lamp from the 
  511.    not created location to the carried one and prints message 3 to 
  512.    tell the player the lamp is now lit.
  513.  
  514.    There are loads of L-P commands you could think of, which ones 
  515.    you use depend on what happens in your adventure. Chapter five 
  516.    gives you more information on all the different things you can 
  517.    do to make a great adventure game.
  518.  
  519.    Lines 2760 to 3210 are reserved for your L-P commands.
  520.  
  521.    Well we are near the end of this chapter (sob!!!) and maybe 
  522.    there are one or two things you don't understand well don't 
  523.    worry, because chapter 6 takes you step by step into creating a 
  524.    game and all the data and commands are written out for you. 
  525.    Plus if you did register with me you would have recieved two 
  526.    extra games and chapters 5 and 6 along with the STOS source 
  527.    code to the example adventure games. You will also have the 
  528.    option to get in touch with me by post or phone for help.
  529.  
  530.    If you do register then I promise that it would be worthwhile 
  531.    as a shareware author promises to be friendly with his or her 
  532.    subscribers and sometimes offers extras. For example I offer 
  533.    you free copys of games I write with sac and when I get a 
  534.    printer you will get a sac manual for a cut price.
  535.  
  536.    Just a couple more things to mention. Line 3380 of the editor 
  537.    program loads the data that you created with the creator, this 
  538.    at the moment looks for a file called GAME.ADV but you can 
  539.    change it to the name of your data file. Line 3610 also needs 
  540.    to be changed to your data files name.
  541.  
  542.    Well thats it for this chapter, see you in chapter 5.
  543.  
  544.